package com.xmler.plugin.adbrocket.adb.command.receiver

import com.android.ddmlib.MultiLineReceiver
import javax.swing.JTextArea

class DisplayReceiver(val view: JTextArea): MultiLineReceiver() {
    private val currentLines: MutableList<String?> = ArrayList()

    override fun isCancelled(): Boolean = false

    override fun processNewLines(lines: Array<String>) {
        for (line in lines) {
            view.append(line)
            if (!line.isNullOrEmpty()) {
                currentLines.add(line)
            }
        }
    }

    val isSuccess: Boolean
        get() = currentLines.size in 1..2
}